//
//  SEGHeadDescView.m
//  ExcellentHome
//
//  Created by 刘山 on 16/12/13.
//  Copyright © 2016年 陈区. All rights reserved.
//

#import "SEGHeadDescView.h"

@implementation SEGHeadDescView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    [self addSubview:self.contentLabel];

    [self.contentLabel setFont:[UIFont systemFontOfSize:13]];
    [self.contentLabel setTextColor:kColor_3];
}

- (void)useWhiteStyle {
    self.contentLabel.textAlignment = NSTextAlignmentLeft;
    self.contentLabel.font = [UIFont boldSystemFontOfSize:15];
    self.contentLabel.textColor = kColor_1;
    self.backgroundColor = kColor_W;
}

- (void)setPosition:(SEGHeadDescViewPosition)positon
{
    switch (positon) {
    case SEGHeadDescViewPosition_Center: {
        [self.contentLabel mas_remakeConstraints:^(MASConstraintMaker* make) {
            make.center.equalTo(self);
        }];
    } break;
    case SEGHeadDescViewPosition_Left: {
        [self.contentLabel mas_remakeConstraints:^(MASConstraintMaker* make) {
            make.left.equalTo(self).mas_offset(15);
            make.centerY.equalTo(self);
        }];
    } break;
    default:
        break;
    }
}

- (UILabel *)contentLabel {
    if (!_contentLabel) {
        _contentLabel = [[UILabel alloc] init];
    }
    return _contentLabel;
}

@end
